#include<iostream>
using namespace std;
#define int long long
const int N = 65;
int dp[N];
signed main()
{
    int n;
    cin >> n;
    int a = 1 , b = 1 , c = 2;
    for(int i = 3;i <= n;i ++)
    {
        int t = a + b + c;
        a = b;
        b = c;
        c = t;
    }
    if(n == 1) cout << b << endl;
    else cout << c << endl;
    return 0;
}